﻿using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ToracTechnologies.ExpressionTreeLibrary.ExtensionMethods.Strings;

namespace ToracTechnologies.ExpressionTree.Testing.ExtensionMethods.Strings
{
    [TestClass]
    public class StringExtensionMethodsUnitTest
    {

        #region Contains Off Of String

        [TestMethod]
        public void ContainsStringExtensions_Test1()
        {
            Assert.AreEqual(true, "Jason".Contains("JASON", StringComparison.OrdinalIgnoreCase));
            Assert.AreEqual(true, "JASON".Contains("JASON", StringComparison.OrdinalIgnoreCase));
            Assert.AreEqual(true, "jason2".Contains("JASON", StringComparison.OrdinalIgnoreCase));
            Assert.AreEqual(false, "test 123".Contains("JASON", StringComparison.OrdinalIgnoreCase));

            Assert.AreEqual(true, "JASON".Contains("JASON", StringComparison.Ordinal));
            Assert.AreEqual(false, "jason2".Contains("JASON", StringComparison.Ordinal));
        }

        #endregion

        #region Contains Off Of List

        [TestMethod]
        public void ContainsStringExtensions_Test2()
        {
            IEnumerable<string> lst = new string[] { "jason1", "jason2", "jason3" };

            Assert.AreEqual(true, lst.Contains("JASON", StringComparison.OrdinalIgnoreCase));
            Assert.AreEqual(false, lst.Contains("JASON", StringComparison.Ordinal));
        }

        #endregion

    }
}
